#!/usr/bin/perl

use strict;
use warnings;
require 'forum_common.pl';

connect_to_database() or bad_deal();
my $user = get_current_user(get_sess_id());

record_this_hit();

print header($forum::http_header), forum_start(forum_cpanel($user));

my $id = url_param('id');
unless (defined $id)
{
	print forum_error('No member specified!');
	goto gameover;
}


my $member = get_user($id);
unless ($member)
{
	print forum_error();
	goto gameover;
}

my $usernm = escapeHTML($member->{USERNM});
my $email = $member->{HIDEE}? '<i>[hidden]</i>' : escapeHTML($member->{EMAIL});
my $dt_regist = timefmt($member->{DT_REGIST});
my $priv = priv($member->{PRIV});
if ($user && $user->{ID} == $member->{ID})
{
	print h3('This is you!');
}
print	'<div class="ftable" style="border-spacing:1em">',
		div({-class=>'ftr'},
			div({-class=>'ftd ralign'}, 'Username:'),
			div({-class=>'ftd usernm'}, $usernm)),
		div({-class=>'ftr'},
			div({-class=>'ftd ralign'}, 'Rank:'),
			div({-class=>'ftd priv'}, $priv)),
		div({-class=>'ftr'},
			div({-class=>'ftd ralign'}, 'Email Address:'),
			div({-class=>'ftd email'}, $email)),
		div({-class=>'ftr'},
			div({-class=>'ftd ralign'}, 'Registered on:'),
			div({-class=>'ftd dt'}, $dt_regist)),
		div({-class=>'ftr'},
			div({-class=>'ftd ralign'}, 'Topics:'),
			div({-class=>'ftd ntopics lalign'}, $member->{NUM_TOPICS})),
		div({-class=>'ftr'},
			div({-class=>'ftd ralign'}, 'Posts:'),
			div({-class=>'ftd nposts lalign'}, $member->{NUM_POSTS})),
		'</div>';

gameover:
print forum_end();
forum_disconnect();
